{
 "cells": [
  {
   "cell_type": "code",
   "id": "1e32a8d7c69b2ca",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T14:08:32.765124Z",
     "start_time": "2025-01-25T14:08:32.498379Z"
    }
   },
   "source": "import pandas as pd",
   "outputs": [],
   "execution_count": 1
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": [
    "# 要读取 csv 文件，你可以使用 Pandas 的 read_csv 函数，它接受一个文件名或一个 URL 作为参数，并返回一个 DataFrame 对象，例如：\n",
    "df = pd.read_csv('data/data.csv')"
   ],
   "id": "d02968b07bee4649"
  },
  {
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-01-25T14:09:23.818926Z",
     "start_time": "2025-01-25T14:09:19.704239Z"
    }
   },
   "cell_type": "code",
   "outputs": [
    {
     "ename": "HTTPError",
     "evalue": "HTTP Error 404: Not Found",
     "output_type": "error",
     "traceback": [
      "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[0;31mHTTPError\u001B[0m                                 Traceback (most recent call last)",
      "Cell \u001B[0;32mIn[2], line 2\u001B[0m\n\u001B[1;32m      1\u001B[0m \u001B[38;5;66;03m# 要读取 csv 文件，你可以使用 Pandas 的 read_csv 函数，它接受一个文件名或一个 URL 作为参数，并返回一个 DataFrame 对象，例如：\u001B[39;00m\n\u001B[0;32m----> 2\u001B[0m \u001B[43mpd\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mread_csv\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mhttps://example.com/nba.csv\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m)\u001B[49m\u001B[38;5;241m.\u001B[39mhead()\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/site-packages/pandas/io/parsers/readers.py:1026\u001B[0m, in \u001B[0;36mread_csv\u001B[0;34m(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, date_format, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, encoding_errors, dialect, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options, dtype_backend)\u001B[0m\n\u001B[1;32m   1013\u001B[0m kwds_defaults \u001B[38;5;241m=\u001B[39m _refine_defaults_read(\n\u001B[1;32m   1014\u001B[0m     dialect,\n\u001B[1;32m   1015\u001B[0m     delimiter,\n\u001B[0;32m   (...)\u001B[0m\n\u001B[1;32m   1022\u001B[0m     dtype_backend\u001B[38;5;241m=\u001B[39mdtype_backend,\n\u001B[1;32m   1023\u001B[0m )\n\u001B[1;32m   1024\u001B[0m kwds\u001B[38;5;241m.\u001B[39mupdate(kwds_defaults)\n\u001B[0;32m-> 1026\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43m_read\u001B[49m\u001B[43m(\u001B[49m\u001B[43mfilepath_or_buffer\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mkwds\u001B[49m\u001B[43m)\u001B[49m\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/site-packages/pandas/io/parsers/readers.py:620\u001B[0m, in \u001B[0;36m_read\u001B[0;34m(filepath_or_buffer, kwds)\u001B[0m\n\u001B[1;32m    617\u001B[0m _validate_names(kwds\u001B[38;5;241m.\u001B[39mget(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mnames\u001B[39m\u001B[38;5;124m\"\u001B[39m, \u001B[38;5;28;01mNone\u001B[39;00m))\n\u001B[1;32m    619\u001B[0m \u001B[38;5;66;03m# Create the parser.\u001B[39;00m\n\u001B[0;32m--> 620\u001B[0m parser \u001B[38;5;241m=\u001B[39m \u001B[43mTextFileReader\u001B[49m\u001B[43m(\u001B[49m\u001B[43mfilepath_or_buffer\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43mkwds\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m    622\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m chunksize \u001B[38;5;129;01mor\u001B[39;00m iterator:\n\u001B[1;32m    623\u001B[0m     \u001B[38;5;28;01mreturn\u001B[39;00m parser\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/site-packages/pandas/io/parsers/readers.py:1620\u001B[0m, in \u001B[0;36mTextFileReader.__init__\u001B[0;34m(self, f, engine, **kwds)\u001B[0m\n\u001B[1;32m   1617\u001B[0m     \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39moptions[\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mhas_index_names\u001B[39m\u001B[38;5;124m\"\u001B[39m] \u001B[38;5;241m=\u001B[39m kwds[\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mhas_index_names\u001B[39m\u001B[38;5;124m\"\u001B[39m]\n\u001B[1;32m   1619\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mhandles: IOHandles \u001B[38;5;241m|\u001B[39m \u001B[38;5;28;01mNone\u001B[39;00m \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[0;32m-> 1620\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_engine \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_make_engine\u001B[49m\u001B[43m(\u001B[49m\u001B[43mf\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mengine\u001B[49m\u001B[43m)\u001B[49m\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/site-packages/pandas/io/parsers/readers.py:1880\u001B[0m, in \u001B[0;36mTextFileReader._make_engine\u001B[0;34m(self, f, engine)\u001B[0m\n\u001B[1;32m   1878\u001B[0m     \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mb\u001B[39m\u001B[38;5;124m\"\u001B[39m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;129;01min\u001B[39;00m mode:\n\u001B[1;32m   1879\u001B[0m         mode \u001B[38;5;241m+\u001B[39m\u001B[38;5;241m=\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mb\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[0;32m-> 1880\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mhandles \u001B[38;5;241m=\u001B[39m \u001B[43mget_handle\u001B[49m\u001B[43m(\u001B[49m\n\u001B[1;32m   1881\u001B[0m \u001B[43m    \u001B[49m\u001B[43mf\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m   1882\u001B[0m \u001B[43m    \u001B[49m\u001B[43mmode\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m   1883\u001B[0m \u001B[43m    \u001B[49m\u001B[43mencoding\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43moptions\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mencoding\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43;01mNone\u001B[39;49;00m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m   1884\u001B[0m \u001B[43m    \u001B[49m\u001B[43mcompression\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43moptions\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mcompression\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43;01mNone\u001B[39;49;00m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m   1885\u001B[0m \u001B[43m    \u001B[49m\u001B[43mmemory_map\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43moptions\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mmemory_map\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43;01mFalse\u001B[39;49;00m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m   1886\u001B[0m \u001B[43m    \u001B[49m\u001B[43mis_text\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mis_text\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m   1887\u001B[0m \u001B[43m    \u001B[49m\u001B[43merrors\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43moptions\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mencoding_errors\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mstrict\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m   1888\u001B[0m \u001B[43m    \u001B[49m\u001B[43mstorage_options\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43moptions\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mstorage_options\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43;01mNone\u001B[39;49;00m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m   1889\u001B[0m \u001B[43m\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m   1890\u001B[0m \u001B[38;5;28;01massert\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mhandles \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[1;32m   1891\u001B[0m f \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mhandles\u001B[38;5;241m.\u001B[39mhandle\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/site-packages/pandas/io/common.py:728\u001B[0m, in \u001B[0;36mget_handle\u001B[0;34m(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)\u001B[0m\n\u001B[1;32m    725\u001B[0m     codecs\u001B[38;5;241m.\u001B[39mlookup_error(errors)\n\u001B[1;32m    727\u001B[0m \u001B[38;5;66;03m# open URLs\u001B[39;00m\n\u001B[0;32m--> 728\u001B[0m ioargs \u001B[38;5;241m=\u001B[39m \u001B[43m_get_filepath_or_buffer\u001B[49m\u001B[43m(\u001B[49m\n\u001B[1;32m    729\u001B[0m \u001B[43m    \u001B[49m\u001B[43mpath_or_buf\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m    730\u001B[0m \u001B[43m    \u001B[49m\u001B[43mencoding\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mencoding\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m    731\u001B[0m \u001B[43m    \u001B[49m\u001B[43mcompression\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mcompression\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m    732\u001B[0m \u001B[43m    \u001B[49m\u001B[43mmode\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mmode\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m    733\u001B[0m \u001B[43m    \u001B[49m\u001B[43mstorage_options\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mstorage_options\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m    734\u001B[0m \u001B[43m\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m    736\u001B[0m handle \u001B[38;5;241m=\u001B[39m ioargs\u001B[38;5;241m.\u001B[39mfilepath_or_buffer\n\u001B[1;32m    737\u001B[0m handles: \u001B[38;5;28mlist\u001B[39m[BaseBuffer]\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/site-packages/pandas/io/common.py:384\u001B[0m, in \u001B[0;36m_get_filepath_or_buffer\u001B[0;34m(filepath_or_buffer, encoding, compression, mode, storage_options)\u001B[0m\n\u001B[1;32m    382\u001B[0m \u001B[38;5;66;03m# assuming storage_options is to be interpreted as headers\u001B[39;00m\n\u001B[1;32m    383\u001B[0m req_info \u001B[38;5;241m=\u001B[39m urllib\u001B[38;5;241m.\u001B[39mrequest\u001B[38;5;241m.\u001B[39mRequest(filepath_or_buffer, headers\u001B[38;5;241m=\u001B[39mstorage_options)\n\u001B[0;32m--> 384\u001B[0m \u001B[38;5;28;01mwith\u001B[39;00m \u001B[43murlopen\u001B[49m\u001B[43m(\u001B[49m\u001B[43mreq_info\u001B[49m\u001B[43m)\u001B[49m \u001B[38;5;28;01mas\u001B[39;00m req:\n\u001B[1;32m    385\u001B[0m     content_encoding \u001B[38;5;241m=\u001B[39m req\u001B[38;5;241m.\u001B[39mheaders\u001B[38;5;241m.\u001B[39mget(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mContent-Encoding\u001B[39m\u001B[38;5;124m\"\u001B[39m, \u001B[38;5;28;01mNone\u001B[39;00m)\n\u001B[1;32m    386\u001B[0m     \u001B[38;5;28;01mif\u001B[39;00m content_encoding \u001B[38;5;241m==\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mgzip\u001B[39m\u001B[38;5;124m\"\u001B[39m:\n\u001B[1;32m    387\u001B[0m         \u001B[38;5;66;03m# Override compression based on Content-Encoding header\u001B[39;00m\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/site-packages/pandas/io/common.py:289\u001B[0m, in \u001B[0;36murlopen\u001B[0;34m(*args, **kwargs)\u001B[0m\n\u001B[1;32m    283\u001B[0m \u001B[38;5;250m\u001B[39m\u001B[38;5;124;03m\"\"\"\u001B[39;00m\n\u001B[1;32m    284\u001B[0m \u001B[38;5;124;03mLazy-import wrapper for stdlib urlopen, as that imports a big chunk of\u001B[39;00m\n\u001B[1;32m    285\u001B[0m \u001B[38;5;124;03mthe stdlib.\u001B[39;00m\n\u001B[1;32m    286\u001B[0m \u001B[38;5;124;03m\"\"\"\u001B[39;00m\n\u001B[1;32m    287\u001B[0m \u001B[38;5;28;01mimport\u001B[39;00m \u001B[38;5;21;01murllib\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mrequest\u001B[39;00m\n\u001B[0;32m--> 289\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43murllib\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mrequest\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43murlopen\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43margs\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43mkwargs\u001B[49m\u001B[43m)\u001B[49m\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/urllib/request.py:216\u001B[0m, in \u001B[0;36murlopen\u001B[0;34m(url, data, timeout, cafile, capath, cadefault, context)\u001B[0m\n\u001B[1;32m    214\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[1;32m    215\u001B[0m     opener \u001B[38;5;241m=\u001B[39m _opener\n\u001B[0;32m--> 216\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mopener\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mopen\u001B[49m\u001B[43m(\u001B[49m\u001B[43murl\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mdata\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mtimeout\u001B[49m\u001B[43m)\u001B[49m\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/urllib/request.py:525\u001B[0m, in \u001B[0;36mOpenerDirector.open\u001B[0;34m(self, fullurl, data, timeout)\u001B[0m\n\u001B[1;32m    523\u001B[0m \u001B[38;5;28;01mfor\u001B[39;00m processor \u001B[38;5;129;01min\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mprocess_response\u001B[38;5;241m.\u001B[39mget(protocol, []):\n\u001B[1;32m    524\u001B[0m     meth \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mgetattr\u001B[39m(processor, meth_name)\n\u001B[0;32m--> 525\u001B[0m     response \u001B[38;5;241m=\u001B[39m \u001B[43mmeth\u001B[49m\u001B[43m(\u001B[49m\u001B[43mreq\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mresponse\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m    527\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m response\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/urllib/request.py:634\u001B[0m, in \u001B[0;36mHTTPErrorProcessor.http_response\u001B[0;34m(self, request, response)\u001B[0m\n\u001B[1;32m    631\u001B[0m \u001B[38;5;66;03m# According to RFC 2616, \"2xx\" code indicates that the client's\u001B[39;00m\n\u001B[1;32m    632\u001B[0m \u001B[38;5;66;03m# request was successfully received, understood, and accepted.\u001B[39;00m\n\u001B[1;32m    633\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m (\u001B[38;5;241m200\u001B[39m \u001B[38;5;241m<\u001B[39m\u001B[38;5;241m=\u001B[39m code \u001B[38;5;241m<\u001B[39m \u001B[38;5;241m300\u001B[39m):\n\u001B[0;32m--> 634\u001B[0m     response \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mparent\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43merror\u001B[49m\u001B[43m(\u001B[49m\n\u001B[1;32m    635\u001B[0m \u001B[43m        \u001B[49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43mhttp\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mrequest\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mresponse\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcode\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mmsg\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mhdrs\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m    637\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m response\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/urllib/request.py:563\u001B[0m, in \u001B[0;36mOpenerDirector.error\u001B[0;34m(self, proto, *args)\u001B[0m\n\u001B[1;32m    561\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m http_err:\n\u001B[1;32m    562\u001B[0m     args \u001B[38;5;241m=\u001B[39m (\u001B[38;5;28mdict\u001B[39m, \u001B[38;5;124m'\u001B[39m\u001B[38;5;124mdefault\u001B[39m\u001B[38;5;124m'\u001B[39m, \u001B[38;5;124m'\u001B[39m\u001B[38;5;124mhttp_error_default\u001B[39m\u001B[38;5;124m'\u001B[39m) \u001B[38;5;241m+\u001B[39m orig_args\n\u001B[0;32m--> 563\u001B[0m     \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_call_chain\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43margs\u001B[49m\u001B[43m)\u001B[49m\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/urllib/request.py:496\u001B[0m, in \u001B[0;36mOpenerDirector._call_chain\u001B[0;34m(self, chain, kind, meth_name, *args)\u001B[0m\n\u001B[1;32m    494\u001B[0m \u001B[38;5;28;01mfor\u001B[39;00m handler \u001B[38;5;129;01min\u001B[39;00m handlers:\n\u001B[1;32m    495\u001B[0m     func \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mgetattr\u001B[39m(handler, meth_name)\n\u001B[0;32m--> 496\u001B[0m     result \u001B[38;5;241m=\u001B[39m \u001B[43mfunc\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43margs\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m    497\u001B[0m     \u001B[38;5;28;01mif\u001B[39;00m result \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[1;32m    498\u001B[0m         \u001B[38;5;28;01mreturn\u001B[39;00m result\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/urllib/request.py:643\u001B[0m, in \u001B[0;36mHTTPDefaultErrorHandler.http_error_default\u001B[0;34m(self, req, fp, code, msg, hdrs)\u001B[0m\n\u001B[1;32m    642\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m \u001B[38;5;21mhttp_error_default\u001B[39m(\u001B[38;5;28mself\u001B[39m, req, fp, code, msg, hdrs):\n\u001B[0;32m--> 643\u001B[0m     \u001B[38;5;28;01mraise\u001B[39;00m HTTPError(req\u001B[38;5;241m.\u001B[39mfull_url, code, msg, hdrs, fp)\n",
      "\u001B[0;31mHTTPError\u001B[0m: HTTP Error 404: Not Found"
     ]
    }
   ],
   "execution_count": 2,
   "source": "# pd.read_csv(\"https://example.com/nba.csv\") # 读取网络文件",
   "id": "initial_id"
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "#### 练习 1：从给定的数据集中打印前五行和最后五行",
   "id": "89a3bc058c33717a"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T14:10:56.799370Z",
     "start_time": "2025-01-25T14:10:56.779278Z"
    }
   },
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "   index      company   body-style  wheel-base  length engine-type  \\\n",
       "0      0  alfa-romero  convertible        88.6   168.8        dohc   \n",
       "1      1  alfa-romero  convertible        88.6   168.8        dohc   \n",
       "2      2  alfa-romero    hatchback        94.5   171.2        ohcv   \n",
       "3      3         audi        sedan        99.8   176.6         ohc   \n",
       "4      4         audi        sedan        99.4   176.6         ohc   \n",
       "\n",
       "  num-of-cylinders  horsepower  average-mileage    price  \n",
       "0             four         111               21  13495.0  \n",
       "1             four         111               21  16500.0  \n",
       "2              six         154               19  16500.0  \n",
       "3             four         102               24  13950.0  \n",
       "4             five         115               18  17450.0  "
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>index</th>\n",
       "      <th>company</th>\n",
       "      <th>body-style</th>\n",
       "      <th>wheel-base</th>\n",
       "      <th>length</th>\n",
       "      <th>engine-type</th>\n",
       "      <th>num-of-cylinders</th>\n",
       "      <th>horsepower</th>\n",
       "      <th>average-mileage</th>\n",
       "      <th>price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>alfa-romero</td>\n",
       "      <td>convertible</td>\n",
       "      <td>88.6</td>\n",
       "      <td>168.8</td>\n",
       "      <td>dohc</td>\n",
       "      <td>four</td>\n",
       "      <td>111</td>\n",
       "      <td>21</td>\n",
       "      <td>13495.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>alfa-romero</td>\n",
       "      <td>convertible</td>\n",
       "      <td>88.6</td>\n",
       "      <td>168.8</td>\n",
       "      <td>dohc</td>\n",
       "      <td>four</td>\n",
       "      <td>111</td>\n",
       "      <td>21</td>\n",
       "      <td>16500.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>alfa-romero</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>94.5</td>\n",
       "      <td>171.2</td>\n",
       "      <td>ohcv</td>\n",
       "      <td>six</td>\n",
       "      <td>154</td>\n",
       "      <td>19</td>\n",
       "      <td>16500.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>audi</td>\n",
       "      <td>sedan</td>\n",
       "      <td>99.8</td>\n",
       "      <td>176.6</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>102</td>\n",
       "      <td>24</td>\n",
       "      <td>13950.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>audi</td>\n",
       "      <td>sedan</td>\n",
       "      <td>99.4</td>\n",
       "      <td>176.6</td>\n",
       "      <td>ohc</td>\n",
       "      <td>five</td>\n",
       "      <td>115</td>\n",
       "      <td>18</td>\n",
       "      <td>17450.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 4,
   "source": "df.head()",
   "id": "d7f0fd318570940b"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T14:16:47.752004Z",
     "start_time": "2025-01-25T14:16:47.740506Z"
    }
   },
   "cell_type": "code",
   "source": "df.tail()",
   "id": "9d67dbd8f9b4be41",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "    index     company body-style  wheel-base  length engine-type  \\\n",
       "56     81  volkswagen      sedan        97.3   171.7         ohc   \n",
       "57     82  volkswagen      sedan        97.3   171.7         ohc   \n",
       "58     86  volkswagen      sedan        97.3   171.7         ohc   \n",
       "59     87       volvo      sedan       104.3   188.8         ohc   \n",
       "60     88       volvo      wagon       104.3   188.8         ohc   \n",
       "\n",
       "   num-of-cylinders  horsepower  average-mileage    price  \n",
       "56             four          85               27   7975.0  \n",
       "57             four          52               37   7995.0  \n",
       "58             four         100               26   9995.0  \n",
       "59             four         114               23  12940.0  \n",
       "60             four         114               23  13415.0  "
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>index</th>\n",
       "      <th>company</th>\n",
       "      <th>body-style</th>\n",
       "      <th>wheel-base</th>\n",
       "      <th>length</th>\n",
       "      <th>engine-type</th>\n",
       "      <th>num-of-cylinders</th>\n",
       "      <th>horsepower</th>\n",
       "      <th>average-mileage</th>\n",
       "      <th>price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>56</th>\n",
       "      <td>81</td>\n",
       "      <td>volkswagen</td>\n",
       "      <td>sedan</td>\n",
       "      <td>97.3</td>\n",
       "      <td>171.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>85</td>\n",
       "      <td>27</td>\n",
       "      <td>7975.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57</th>\n",
       "      <td>82</td>\n",
       "      <td>volkswagen</td>\n",
       "      <td>sedan</td>\n",
       "      <td>97.3</td>\n",
       "      <td>171.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>52</td>\n",
       "      <td>37</td>\n",
       "      <td>7995.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>58</th>\n",
       "      <td>86</td>\n",
       "      <td>volkswagen</td>\n",
       "      <td>sedan</td>\n",
       "      <td>97.3</td>\n",
       "      <td>171.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>100</td>\n",
       "      <td>26</td>\n",
       "      <td>9995.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59</th>\n",
       "      <td>87</td>\n",
       "      <td>volvo</td>\n",
       "      <td>sedan</td>\n",
       "      <td>104.3</td>\n",
       "      <td>188.8</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>114</td>\n",
       "      <td>23</td>\n",
       "      <td>12940.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60</th>\n",
       "      <td>88</td>\n",
       "      <td>volvo</td>\n",
       "      <td>wagon</td>\n",
       "      <td>104.3</td>\n",
       "      <td>188.8</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>114</td>\n",
       "      <td>23</td>\n",
       "      <td>13415.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 5
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "#### 练习2：处理数据集缺失值",
   "id": "a7101a120494c72c"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T14:24:22.688225Z",
     "start_time": "2025-01-25T14:24:22.459294Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 通过如下方式获取存在null的行\n",
    "df[df.isnull().any(axis=1)]"
   ],
   "id": "cceb6a499b68bd29",
   "outputs": [
    {
     "ename": "NotImplementedError",
     "evalue": "iLocation based boolean indexing on an integer type is not available",
     "output_type": "error",
     "traceback": [
      "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[0;31mNotImplementedError\u001B[0m                       Traceback (most recent call last)",
      "Cell \u001B[0;32mIn[14], line 2\u001B[0m\n\u001B[1;32m      1\u001B[0m \u001B[38;5;66;03m# 通过如下方式获取存在null的行\u001B[39;00m\n\u001B[0;32m----> 2\u001B[0m \u001B[43mdf\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43miloc\u001B[49m\u001B[43m[\u001B[49m\u001B[43mdf\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43misnull\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43many\u001B[49m\u001B[43m(\u001B[49m\u001B[43maxis\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;241;43m1\u001B[39;49m\u001B[43m)\u001B[49m\u001B[43m]\u001B[49m\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/site-packages/pandas/core/indexing.py:1191\u001B[0m, in \u001B[0;36m_LocationIndexer.__getitem__\u001B[0;34m(self, key)\u001B[0m\n\u001B[1;32m   1189\u001B[0m maybe_callable \u001B[38;5;241m=\u001B[39m com\u001B[38;5;241m.\u001B[39mapply_if_callable(key, \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mobj)\n\u001B[1;32m   1190\u001B[0m maybe_callable \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_check_deprecated_callable_usage(key, maybe_callable)\n\u001B[0;32m-> 1191\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_getitem_axis\u001B[49m\u001B[43m(\u001B[49m\u001B[43mmaybe_callable\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43maxis\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43maxis\u001B[49m\u001B[43m)\u001B[49m\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/site-packages/pandas/core/indexing.py:1738\u001B[0m, in \u001B[0;36m_iLocIndexer._getitem_axis\u001B[0;34m(self, key, axis)\u001B[0m\n\u001B[1;32m   1735\u001B[0m     key \u001B[38;5;241m=\u001B[39m np\u001B[38;5;241m.\u001B[39masarray(key)\n\u001B[1;32m   1737\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m com\u001B[38;5;241m.\u001B[39mis_bool_indexer(key):\n\u001B[0;32m-> 1738\u001B[0m     \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_validate_key\u001B[49m\u001B[43m(\u001B[49m\u001B[43mkey\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43maxis\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m   1739\u001B[0m     \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_getbool_axis(key, axis\u001B[38;5;241m=\u001B[39maxis)\n\u001B[1;32m   1741\u001B[0m \u001B[38;5;66;03m# a list of integers\u001B[39;00m\n",
      "File \u001B[0;32m~/anaconda3/envs/jrrg/lib/python3.10/site-packages/pandas/core/indexing.py:1578\u001B[0m, in \u001B[0;36m_iLocIndexer._validate_key\u001B[0;34m(self, key, axis)\u001B[0m\n\u001B[1;32m   1576\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mhasattr\u001B[39m(key, \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mindex\u001B[39m\u001B[38;5;124m\"\u001B[39m) \u001B[38;5;129;01mand\u001B[39;00m \u001B[38;5;28misinstance\u001B[39m(key\u001B[38;5;241m.\u001B[39mindex, Index):\n\u001B[1;32m   1577\u001B[0m     \u001B[38;5;28;01mif\u001B[39;00m key\u001B[38;5;241m.\u001B[39mindex\u001B[38;5;241m.\u001B[39minferred_type \u001B[38;5;241m==\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124minteger\u001B[39m\u001B[38;5;124m\"\u001B[39m:\n\u001B[0;32m-> 1578\u001B[0m         \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mNotImplementedError\u001B[39;00m(\n\u001B[1;32m   1579\u001B[0m             \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124miLocation based boolean \u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m   1580\u001B[0m             \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mindexing on an integer type \u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m   1581\u001B[0m             \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mis not available\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m   1582\u001B[0m         )\n\u001B[1;32m   1583\u001B[0m     \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mValueError\u001B[39;00m(\n\u001B[1;32m   1584\u001B[0m         \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124miLocation based boolean indexing cannot use \u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m   1585\u001B[0m         \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124man indexable as a mask\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m   1586\u001B[0m     )\n\u001B[1;32m   1587\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m\n",
      "\u001B[0;31mNotImplementedError\u001B[0m: iLocation based boolean indexing on an integer type is not available"
     ]
    }
   ],
   "execution_count": 14
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T14:20:26.713588Z",
     "start_time": "2025-01-25T14:20:26.708947Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 可以通过dropna删除这些行，返回删除之后的结果\n",
    "df_cleaned = df.dropna(axis=0, how='any')"
   ],
   "id": "5a7f30c35d870e2c",
   "outputs": [],
   "execution_count": 11
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T14:20:42.084206Z",
     "start_time": "2025-01-25T14:20:42.065060Z"
    }
   },
   "cell_type": "code",
   "source": "len(df_cleaned), len(df)",
   "id": "7ad57a4097eca2fa",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(58, 61)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 13
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "#### 练习 3：找到最贵的汽车公司名称",
   "id": "9c814d92830f799d"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T14:25:54.562866Z",
     "start_time": "2025-01-25T14:25:54.528912Z"
    }
   },
   "cell_type": "code",
   "source": "df_cleaned.loc[df_cleaned.price == df_cleaned['price'].max()]",
   "id": "c20c79406ed62024",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "    index        company body-style  wheel-base  length engine-type  \\\n",
       "35     47  mercedes-benz    hardtop       112.0   199.2        ohcv   \n",
       "\n",
       "   num-of-cylinders  horsepower  average-mileage    price  \n",
       "35            eight         184               14  45400.0  "
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>index</th>\n",
       "      <th>company</th>\n",
       "      <th>body-style</th>\n",
       "      <th>wheel-base</th>\n",
       "      <th>length</th>\n",
       "      <th>engine-type</th>\n",
       "      <th>num-of-cylinders</th>\n",
       "      <th>horsepower</th>\n",
       "      <th>average-mileage</th>\n",
       "      <th>price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>47</td>\n",
       "      <td>mercedes-benz</td>\n",
       "      <td>hardtop</td>\n",
       "      <td>112.0</td>\n",
       "      <td>199.2</td>\n",
       "      <td>ohcv</td>\n",
       "      <td>eight</td>\n",
       "      <td>184</td>\n",
       "      <td>14</td>\n",
       "      <td>45400.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 15
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "#### 练习 4：打印所有丰田汽车的详细信息",
   "id": "445552e9eda7854b"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T14:27:38.370047Z",
     "start_time": "2025-01-25T14:27:38.357197Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 方法1，同练习3\n",
    "df_cleaned.loc[df_cleaned.company == 'toyota']"
   ],
   "id": "9d583dab510873fa",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "    index company body-style  wheel-base  length engine-type num-of-cylinders  \\\n",
       "48     66  toyota  hatchback        95.7   158.7         ohc             four   \n",
       "49     67  toyota  hatchback        95.7   158.7         ohc             four   \n",
       "50     68  toyota  hatchback        95.7   158.7         ohc             four   \n",
       "51     69  toyota      wagon        95.7   169.7         ohc             four   \n",
       "52     70  toyota      wagon        95.7   169.7         ohc             four   \n",
       "53     71  toyota      wagon        95.7   169.7         ohc             four   \n",
       "54     79  toyota      wagon       104.5   187.8        dohc              six   \n",
       "\n",
       "    horsepower  average-mileage    price  \n",
       "48          62               35   5348.0  \n",
       "49          62               31   6338.0  \n",
       "50          62               31   6488.0  \n",
       "51          62               31   6918.0  \n",
       "52          62               27   7898.0  \n",
       "53          62               27   8778.0  \n",
       "54         156               19  15750.0  "
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>index</th>\n",
       "      <th>company</th>\n",
       "      <th>body-style</th>\n",
       "      <th>wheel-base</th>\n",
       "      <th>length</th>\n",
       "      <th>engine-type</th>\n",
       "      <th>num-of-cylinders</th>\n",
       "      <th>horsepower</th>\n",
       "      <th>average-mileage</th>\n",
       "      <th>price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>66</td>\n",
       "      <td>toyota</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>95.7</td>\n",
       "      <td>158.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>35</td>\n",
       "      <td>5348.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>67</td>\n",
       "      <td>toyota</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>95.7</td>\n",
       "      <td>158.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>31</td>\n",
       "      <td>6338.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>68</td>\n",
       "      <td>toyota</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>95.7</td>\n",
       "      <td>158.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>31</td>\n",
       "      <td>6488.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>69</td>\n",
       "      <td>toyota</td>\n",
       "      <td>wagon</td>\n",
       "      <td>95.7</td>\n",
       "      <td>169.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>31</td>\n",
       "      <td>6918.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52</th>\n",
       "      <td>70</td>\n",
       "      <td>toyota</td>\n",
       "      <td>wagon</td>\n",
       "      <td>95.7</td>\n",
       "      <td>169.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>27</td>\n",
       "      <td>7898.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>71</td>\n",
       "      <td>toyota</td>\n",
       "      <td>wagon</td>\n",
       "      <td>95.7</td>\n",
       "      <td>169.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>27</td>\n",
       "      <td>8778.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>79</td>\n",
       "      <td>toyota</td>\n",
       "      <td>wagon</td>\n",
       "      <td>104.5</td>\n",
       "      <td>187.8</td>\n",
       "      <td>dohc</td>\n",
       "      <td>six</td>\n",
       "      <td>156</td>\n",
       "      <td>19</td>\n",
       "      <td>15750.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 16
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T14:29:22.367078Z",
     "start_time": "2025-01-25T14:29:22.354086Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 方法2，聚合\n",
    "df_cleaned.groupby('company').get_group('toyota')"
   ],
   "id": "858f11af9dace94d",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "    index company body-style  wheel-base  length engine-type num-of-cylinders  \\\n",
       "48     66  toyota  hatchback        95.7   158.7         ohc             four   \n",
       "49     67  toyota  hatchback        95.7   158.7         ohc             four   \n",
       "50     68  toyota  hatchback        95.7   158.7         ohc             four   \n",
       "51     69  toyota      wagon        95.7   169.7         ohc             four   \n",
       "52     70  toyota      wagon        95.7   169.7         ohc             four   \n",
       "53     71  toyota      wagon        95.7   169.7         ohc             four   \n",
       "54     79  toyota      wagon       104.5   187.8        dohc              six   \n",
       "\n",
       "    horsepower  average-mileage    price  \n",
       "48          62               35   5348.0  \n",
       "49          62               31   6338.0  \n",
       "50          62               31   6488.0  \n",
       "51          62               31   6918.0  \n",
       "52          62               27   7898.0  \n",
       "53          62               27   8778.0  \n",
       "54         156               19  15750.0  "
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>index</th>\n",
       "      <th>company</th>\n",
       "      <th>body-style</th>\n",
       "      <th>wheel-base</th>\n",
       "      <th>length</th>\n",
       "      <th>engine-type</th>\n",
       "      <th>num-of-cylinders</th>\n",
       "      <th>horsepower</th>\n",
       "      <th>average-mileage</th>\n",
       "      <th>price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>66</td>\n",
       "      <td>toyota</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>95.7</td>\n",
       "      <td>158.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>35</td>\n",
       "      <td>5348.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>67</td>\n",
       "      <td>toyota</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>95.7</td>\n",
       "      <td>158.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>31</td>\n",
       "      <td>6338.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>68</td>\n",
       "      <td>toyota</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>95.7</td>\n",
       "      <td>158.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>31</td>\n",
       "      <td>6488.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>69</td>\n",
       "      <td>toyota</td>\n",
       "      <td>wagon</td>\n",
       "      <td>95.7</td>\n",
       "      <td>169.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>31</td>\n",
       "      <td>6918.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52</th>\n",
       "      <td>70</td>\n",
       "      <td>toyota</td>\n",
       "      <td>wagon</td>\n",
       "      <td>95.7</td>\n",
       "      <td>169.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>27</td>\n",
       "      <td>7898.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>71</td>\n",
       "      <td>toyota</td>\n",
       "      <td>wagon</td>\n",
       "      <td>95.7</td>\n",
       "      <td>169.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>27</td>\n",
       "      <td>8778.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>79</td>\n",
       "      <td>toyota</td>\n",
       "      <td>wagon</td>\n",
       "      <td>104.5</td>\n",
       "      <td>187.8</td>\n",
       "      <td>dohc</td>\n",
       "      <td>six</td>\n",
       "      <td>156</td>\n",
       "      <td>19</td>\n",
       "      <td>15750.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 18
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "#### 练习 5：找到每家公司的最高价格汽车",
   "id": "f5b8d57c90601132"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T14:35:27.097250Z",
     "start_time": "2025-01-25T14:35:27.089022Z"
    }
   },
   "cell_type": "code",
   "source": [
    "df_by_company = df_cleaned.groupby('company')\n",
    "df_by_company[['price']].max() # 传入需要进行统计的列名"
   ],
   "id": "361a2b40b8abf6ae",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "company\n",
       "alfa-romero      16500.0\n",
       "audi             18920.0\n",
       "bmw              41315.0\n",
       "chevrolet         6575.0\n",
       "dodge             6377.0\n",
       "honda            12945.0\n",
       "isuzu             6785.0\n",
       "jaguar           36000.0\n",
       "mazda            18344.0\n",
       "mercedes-benz    45400.0\n",
       "mitsubishi        8189.0\n",
       "nissan           13499.0\n",
       "porsche          37028.0\n",
       "toyota           15750.0\n",
       "volkswagen        9995.0\n",
       "volvo            13415.0\n",
       "Name: price, dtype: float64"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 32
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T14:35:59.772269Z",
     "start_time": "2025-01-25T14:35:59.763493Z"
    }
   },
   "cell_type": "code",
   "source": "df_by_company[['price']].mean()",
   "id": "699393b6b0d934ab",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "                      price\n",
       "company                    \n",
       "alfa-romero    15498.333333\n",
       "audi           16392.500000\n",
       "bmw            27213.333333\n",
       "chevrolet       6007.000000\n",
       "dodge           6303.000000\n",
       "honda          10195.000000\n",
       "isuzu           6785.000000\n",
       "jaguar         34600.000000\n",
       "mazda           9654.800000\n",
       "mercedes-benz  35040.000000\n",
       "mitsubishi      6689.000000\n",
       "nissan          8289.000000\n",
       "porsche        35528.000000\n",
       "toyota          8216.857143\n",
       "volkswagen      8435.000000\n",
       "volvo          13177.500000"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>price</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>company</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>alfa-romero</th>\n",
       "      <td>15498.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>audi</th>\n",
       "      <td>16392.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>bmw</th>\n",
       "      <td>27213.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>chevrolet</th>\n",
       "      <td>6007.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dodge</th>\n",
       "      <td>6303.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>honda</th>\n",
       "      <td>10195.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>isuzu</th>\n",
       "      <td>6785.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>jaguar</th>\n",
       "      <td>34600.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mazda</th>\n",
       "      <td>9654.800000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mercedes-benz</th>\n",
       "      <td>35040.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mitsubishi</th>\n",
       "      <td>6689.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>nissan</th>\n",
       "      <td>8289.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>porsche</th>\n",
       "      <td>35528.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>toyota</th>\n",
       "      <td>8216.857143</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>volkswagen</th>\n",
       "      <td>8435.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>volvo</th>\n",
       "      <td>13177.500000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 34
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "#### 练习 6：计算每家公司的汽车总数",
   "id": "bf1f95c183eb830b"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T14:38:38.449808Z",
     "start_time": "2025-01-25T14:38:38.443739Z"
    }
   },
   "cell_type": "code",
   "source": [
    "# 使用之前的分组方式\n",
    "df_by_company['company'].count()"
   ],
   "id": "538fd79c6e285bcc",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "company\n",
       "alfa-romero      3\n",
       "audi             4\n",
       "bmw              6\n",
       "chevrolet        3\n",
       "dodge            2\n",
       "honda            3\n",
       "isuzu            1\n",
       "jaguar           3\n",
       "mazda            5\n",
       "mercedes-benz    4\n",
       "mitsubishi       4\n",
       "nissan           5\n",
       "porsche          2\n",
       "toyota           7\n",
       "volkswagen       4\n",
       "volvo            2\n",
       "Name: company, dtype: int64"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 38
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T14:41:04.750098Z",
     "start_time": "2025-01-25T14:41:04.730667Z"
    }
   },
   "cell_type": "code",
   "source": "df_cleaned['company']",
   "id": "265840c52b57a683",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0       alfa-romero\n",
       "1       alfa-romero\n",
       "2       alfa-romero\n",
       "3              audi\n",
       "4              audi\n",
       "5              audi\n",
       "6              audi\n",
       "7               bmw\n",
       "8               bmw\n",
       "9               bmw\n",
       "10              bmw\n",
       "11              bmw\n",
       "12              bmw\n",
       "13        chevrolet\n",
       "14        chevrolet\n",
       "15        chevrolet\n",
       "16            dodge\n",
       "17            dodge\n",
       "18            honda\n",
       "19            honda\n",
       "20            honda\n",
       "21            isuzu\n",
       "24           jaguar\n",
       "25           jaguar\n",
       "26           jaguar\n",
       "27            mazda\n",
       "28            mazda\n",
       "29            mazda\n",
       "30            mazda\n",
       "31            mazda\n",
       "32    mercedes-benz\n",
       "33    mercedes-benz\n",
       "34    mercedes-benz\n",
       "35    mercedes-benz\n",
       "36       mitsubishi\n",
       "37       mitsubishi\n",
       "38       mitsubishi\n",
       "39       mitsubishi\n",
       "40           nissan\n",
       "41           nissan\n",
       "42           nissan\n",
       "43           nissan\n",
       "44           nissan\n",
       "45          porsche\n",
       "46          porsche\n",
       "48           toyota\n",
       "49           toyota\n",
       "50           toyota\n",
       "51           toyota\n",
       "52           toyota\n",
       "53           toyota\n",
       "54           toyota\n",
       "55       volkswagen\n",
       "56       volkswagen\n",
       "57       volkswagen\n",
       "58       volkswagen\n",
       "59            volvo\n",
       "60            volvo\n",
       "Name: company, dtype: object"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 42
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T14:42:02.784373Z",
     "start_time": "2025-01-25T14:42:02.777933Z"
    }
   },
   "cell_type": "code",
   "source": "df_cleaned['company'].value_counts()",
   "id": "eecf6de8c592ed04",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "company\n",
       "toyota           7\n",
       "bmw              6\n",
       "mazda            5\n",
       "nissan           5\n",
       "mercedes-benz    4\n",
       "audi             4\n",
       "volkswagen       4\n",
       "mitsubishi       4\n",
       "chevrolet        3\n",
       "alfa-romero      3\n",
       "jaguar           3\n",
       "honda            3\n",
       "porsche          2\n",
       "dodge            2\n",
       "volvo            2\n",
       "isuzu            1\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 47
  },
  {
   "metadata": {},
   "cell_type": "markdown",
   "source": "#### 练习 7：按价格列对所有汽车进行排序",
   "id": "e97daa596cfb4cb9"
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-01-25T14:44:25.030665Z",
     "start_time": "2025-01-25T14:44:25.008879Z"
    }
   },
   "cell_type": "code",
   "source": "df_cleaned.sort_values(by=['price'], ascending=False)",
   "id": "dac5330756e9678a",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "    index        company   body-style  wheel-base  length engine-type  \\\n",
       "35     47  mercedes-benz      hardtop       112.0   199.2        ohcv   \n",
       "11     14            bmw        sedan       103.5   193.8         ohc   \n",
       "34     46  mercedes-benz        sedan       120.9   208.1        ohcv   \n",
       "46     62        porsche  convertible        89.5   168.9        ohcf   \n",
       "12     15            bmw        sedan       110.0   197.0         ohc   \n",
       "26     35         jaguar        sedan       102.0   191.7        ohcv   \n",
       "25     34         jaguar        sedan       113.0   199.6        dohc   \n",
       "45     61        porsche      hardtop        89.5   168.9        ohcf   \n",
       "24     33         jaguar        sedan       113.0   199.6        dohc   \n",
       "10     13            bmw        sedan       103.5   189.0         ohc   \n",
       "33     45  mercedes-benz        wagon       110.0   190.9         ohc   \n",
       "32     44  mercedes-benz        sedan       110.0   190.9         ohc   \n",
       "9      11            bmw        sedan       101.2   176.8         ohc   \n",
       "6       6           audi        wagon       105.8   192.7         ohc   \n",
       "31     43          mazda        sedan       104.9   175.0         ohc   \n",
       "4       4           audi        sedan        99.4   176.6         ohc   \n",
       "8      10            bmw        sedan       101.2   176.8         ohc   \n",
       "1       1    alfa-romero  convertible        88.6   168.8        dohc   \n",
       "2       2    alfa-romero    hatchback        94.5   171.2        ohcv   \n",
       "7       9            bmw        sedan       101.2   176.8         ohc   \n",
       "54     79         toyota        wagon       104.5   187.8        dohc   \n",
       "5       5           audi        sedan        99.8   177.3         ohc   \n",
       "3       3           audi        sedan        99.8   176.6         ohc   \n",
       "44     57         nissan        sedan       100.4   184.6        ohcv   \n",
       "0       0    alfa-romero  convertible        88.6   168.8        dohc   \n",
       "60     88          volvo        wagon       104.3   188.8         ohc   \n",
       "19     28          honda        sedan        96.5   175.4         ohc   \n",
       "59     87          volvo        sedan       104.3   188.8         ohc   \n",
       "30     39          mazda    hatchback        95.3   169.0       rotor   \n",
       "20     29          honda        sedan        96.5   169.1         ohc   \n",
       "58     86     volkswagen        sedan        97.3   171.7         ohc   \n",
       "53     71         toyota        wagon        95.7   169.7         ohc   \n",
       "39     52     mitsubishi        sedan        96.3   172.4         ohc   \n",
       "57     82     volkswagen        sedan        97.3   171.7         ohc   \n",
       "56     81     volkswagen        sedan        97.3   171.7         ohc   \n",
       "52     70         toyota        wagon        95.7   169.7         ohc   \n",
       "55     80     volkswagen        sedan        97.3   171.7         ohc   \n",
       "43     56         nissan        wagon        94.5   170.2         ohc   \n",
       "18     27          honda        wagon        96.5   157.1         ohc   \n",
       "40     53         nissan        sedan        94.5   165.3         ohc   \n",
       "38     51     mitsubishi        sedan        96.3   172.4         ohc   \n",
       "51     69         toyota        wagon        95.7   169.7         ohc   \n",
       "42     55         nissan        sedan        94.5   165.3         ohc   \n",
       "29     38          mazda    hatchback        93.1   159.1         ohc   \n",
       "21     30          isuzu        sedan        94.3   170.7         ohc   \n",
       "41     54         nissan        sedan        94.5   165.3         ohc   \n",
       "15     18      chevrolet        sedan        94.5   158.8         ohc   \n",
       "50     68         toyota    hatchback        95.7   158.7         ohc   \n",
       "16     19          dodge    hatchback        93.7   157.3         ohc   \n",
       "49     67         toyota    hatchback        95.7   158.7         ohc   \n",
       "14     17      chevrolet    hatchback        94.5   155.9         ohc   \n",
       "17     20          dodge    hatchback        93.7   157.3         ohc   \n",
       "37     50     mitsubishi    hatchback        93.7   157.3         ohc   \n",
       "28     37          mazda    hatchback        93.1   159.1         ohc   \n",
       "36     49     mitsubishi    hatchback        93.7   157.3         ohc   \n",
       "48     66         toyota    hatchback        95.7   158.7         ohc   \n",
       "27     36          mazda    hatchback        93.1   159.1         ohc   \n",
       "13     16      chevrolet    hatchback        88.4   141.1           l   \n",
       "\n",
       "   num-of-cylinders  horsepower  average-mileage    price  \n",
       "35            eight         184               14  45400.0  \n",
       "11              six         182               16  41315.0  \n",
       "34            eight         184               14  40960.0  \n",
       "46              six         207               17  37028.0  \n",
       "12              six         182               15  36880.0  \n",
       "26           twelve         262               13  36000.0  \n",
       "25              six         176               15  35550.0  \n",
       "45              six         207               17  34028.0  \n",
       "24              six         176               15  32250.0  \n",
       "10              six         182               16  30760.0  \n",
       "33             five         123               22  28248.0  \n",
       "32             five         123               22  25552.0  \n",
       "9               six         121               21  20970.0  \n",
       "6              five         110               19  18920.0  \n",
       "31             four          72               31  18344.0  \n",
       "4              five         115               18  17450.0  \n",
       "8              four         101               23  16925.0  \n",
       "1              four         111               21  16500.0  \n",
       "2               six         154               19  16500.0  \n",
       "7              four         101               23  16430.0  \n",
       "54              six         156               19  15750.0  \n",
       "5              five         110               19  15250.0  \n",
       "3              four         102               24  13950.0  \n",
       "44              six         152               19  13499.0  \n",
       "0              four         111               21  13495.0  \n",
       "60             four         114               23  13415.0  \n",
       "19             four         101               24  12945.0  \n",
       "59             four         114               23  12940.0  \n",
       "30              two         101               17  11845.0  \n",
       "20             four         100               25  10345.0  \n",
       "58             four         100               26   9995.0  \n",
       "53             four          62               27   8778.0  \n",
       "39             four          88               25   8189.0  \n",
       "57             four          52               37   7995.0  \n",
       "56             four          85               27   7975.0  \n",
       "52             four          62               27   7898.0  \n",
       "55             four          52               37   7775.0  \n",
       "43             four          69               31   7349.0  \n",
       "18             four          76               30   7295.0  \n",
       "40             four          55               45   7099.0  \n",
       "38             four          88               25   6989.0  \n",
       "51             four          62               31   6918.0  \n",
       "42             four          69               31   6849.0  \n",
       "29             four          68               31   6795.0  \n",
       "21             four          78               24   6785.0  \n",
       "41             four          69               31   6649.0  \n",
       "15             four          70               38   6575.0  \n",
       "50             four          62               31   6488.0  \n",
       "16             four          68               31   6377.0  \n",
       "49             four          62               31   6338.0  \n",
       "14             four          70               38   6295.0  \n",
       "17             four          68               31   6229.0  \n",
       "37             four          68               31   6189.0  \n",
       "28             four          68               31   6095.0  \n",
       "36             four          68               37   5389.0  \n",
       "48             four          62               35   5348.0  \n",
       "27             four          68               30   5195.0  \n",
       "13            three          48               47   5151.0  "
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>index</th>\n",
       "      <th>company</th>\n",
       "      <th>body-style</th>\n",
       "      <th>wheel-base</th>\n",
       "      <th>length</th>\n",
       "      <th>engine-type</th>\n",
       "      <th>num-of-cylinders</th>\n",
       "      <th>horsepower</th>\n",
       "      <th>average-mileage</th>\n",
       "      <th>price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>47</td>\n",
       "      <td>mercedes-benz</td>\n",
       "      <td>hardtop</td>\n",
       "      <td>112.0</td>\n",
       "      <td>199.2</td>\n",
       "      <td>ohcv</td>\n",
       "      <td>eight</td>\n",
       "      <td>184</td>\n",
       "      <td>14</td>\n",
       "      <td>45400.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>14</td>\n",
       "      <td>bmw</td>\n",
       "      <td>sedan</td>\n",
       "      <td>103.5</td>\n",
       "      <td>193.8</td>\n",
       "      <td>ohc</td>\n",
       "      <td>six</td>\n",
       "      <td>182</td>\n",
       "      <td>16</td>\n",
       "      <td>41315.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>46</td>\n",
       "      <td>mercedes-benz</td>\n",
       "      <td>sedan</td>\n",
       "      <td>120.9</td>\n",
       "      <td>208.1</td>\n",
       "      <td>ohcv</td>\n",
       "      <td>eight</td>\n",
       "      <td>184</td>\n",
       "      <td>14</td>\n",
       "      <td>40960.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>62</td>\n",
       "      <td>porsche</td>\n",
       "      <td>convertible</td>\n",
       "      <td>89.5</td>\n",
       "      <td>168.9</td>\n",
       "      <td>ohcf</td>\n",
       "      <td>six</td>\n",
       "      <td>207</td>\n",
       "      <td>17</td>\n",
       "      <td>37028.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>15</td>\n",
       "      <td>bmw</td>\n",
       "      <td>sedan</td>\n",
       "      <td>110.0</td>\n",
       "      <td>197.0</td>\n",
       "      <td>ohc</td>\n",
       "      <td>six</td>\n",
       "      <td>182</td>\n",
       "      <td>15</td>\n",
       "      <td>36880.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>35</td>\n",
       "      <td>jaguar</td>\n",
       "      <td>sedan</td>\n",
       "      <td>102.0</td>\n",
       "      <td>191.7</td>\n",
       "      <td>ohcv</td>\n",
       "      <td>twelve</td>\n",
       "      <td>262</td>\n",
       "      <td>13</td>\n",
       "      <td>36000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>34</td>\n",
       "      <td>jaguar</td>\n",
       "      <td>sedan</td>\n",
       "      <td>113.0</td>\n",
       "      <td>199.6</td>\n",
       "      <td>dohc</td>\n",
       "      <td>six</td>\n",
       "      <td>176</td>\n",
       "      <td>15</td>\n",
       "      <td>35550.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>61</td>\n",
       "      <td>porsche</td>\n",
       "      <td>hardtop</td>\n",
       "      <td>89.5</td>\n",
       "      <td>168.9</td>\n",
       "      <td>ohcf</td>\n",
       "      <td>six</td>\n",
       "      <td>207</td>\n",
       "      <td>17</td>\n",
       "      <td>34028.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>33</td>\n",
       "      <td>jaguar</td>\n",
       "      <td>sedan</td>\n",
       "      <td>113.0</td>\n",
       "      <td>199.6</td>\n",
       "      <td>dohc</td>\n",
       "      <td>six</td>\n",
       "      <td>176</td>\n",
       "      <td>15</td>\n",
       "      <td>32250.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>13</td>\n",
       "      <td>bmw</td>\n",
       "      <td>sedan</td>\n",
       "      <td>103.5</td>\n",
       "      <td>189.0</td>\n",
       "      <td>ohc</td>\n",
       "      <td>six</td>\n",
       "      <td>182</td>\n",
       "      <td>16</td>\n",
       "      <td>30760.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>45</td>\n",
       "      <td>mercedes-benz</td>\n",
       "      <td>wagon</td>\n",
       "      <td>110.0</td>\n",
       "      <td>190.9</td>\n",
       "      <td>ohc</td>\n",
       "      <td>five</td>\n",
       "      <td>123</td>\n",
       "      <td>22</td>\n",
       "      <td>28248.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>44</td>\n",
       "      <td>mercedes-benz</td>\n",
       "      <td>sedan</td>\n",
       "      <td>110.0</td>\n",
       "      <td>190.9</td>\n",
       "      <td>ohc</td>\n",
       "      <td>five</td>\n",
       "      <td>123</td>\n",
       "      <td>22</td>\n",
       "      <td>25552.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>11</td>\n",
       "      <td>bmw</td>\n",
       "      <td>sedan</td>\n",
       "      <td>101.2</td>\n",
       "      <td>176.8</td>\n",
       "      <td>ohc</td>\n",
       "      <td>six</td>\n",
       "      <td>121</td>\n",
       "      <td>21</td>\n",
       "      <td>20970.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>6</td>\n",
       "      <td>audi</td>\n",
       "      <td>wagon</td>\n",
       "      <td>105.8</td>\n",
       "      <td>192.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>five</td>\n",
       "      <td>110</td>\n",
       "      <td>19</td>\n",
       "      <td>18920.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>43</td>\n",
       "      <td>mazda</td>\n",
       "      <td>sedan</td>\n",
       "      <td>104.9</td>\n",
       "      <td>175.0</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>72</td>\n",
       "      <td>31</td>\n",
       "      <td>18344.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>audi</td>\n",
       "      <td>sedan</td>\n",
       "      <td>99.4</td>\n",
       "      <td>176.6</td>\n",
       "      <td>ohc</td>\n",
       "      <td>five</td>\n",
       "      <td>115</td>\n",
       "      <td>18</td>\n",
       "      <td>17450.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>10</td>\n",
       "      <td>bmw</td>\n",
       "      <td>sedan</td>\n",
       "      <td>101.2</td>\n",
       "      <td>176.8</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>101</td>\n",
       "      <td>23</td>\n",
       "      <td>16925.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>alfa-romero</td>\n",
       "      <td>convertible</td>\n",
       "      <td>88.6</td>\n",
       "      <td>168.8</td>\n",
       "      <td>dohc</td>\n",
       "      <td>four</td>\n",
       "      <td>111</td>\n",
       "      <td>21</td>\n",
       "      <td>16500.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>alfa-romero</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>94.5</td>\n",
       "      <td>171.2</td>\n",
       "      <td>ohcv</td>\n",
       "      <td>six</td>\n",
       "      <td>154</td>\n",
       "      <td>19</td>\n",
       "      <td>16500.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>9</td>\n",
       "      <td>bmw</td>\n",
       "      <td>sedan</td>\n",
       "      <td>101.2</td>\n",
       "      <td>176.8</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>101</td>\n",
       "      <td>23</td>\n",
       "      <td>16430.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>79</td>\n",
       "      <td>toyota</td>\n",
       "      <td>wagon</td>\n",
       "      <td>104.5</td>\n",
       "      <td>187.8</td>\n",
       "      <td>dohc</td>\n",
       "      <td>six</td>\n",
       "      <td>156</td>\n",
       "      <td>19</td>\n",
       "      <td>15750.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5</td>\n",
       "      <td>audi</td>\n",
       "      <td>sedan</td>\n",
       "      <td>99.8</td>\n",
       "      <td>177.3</td>\n",
       "      <td>ohc</td>\n",
       "      <td>five</td>\n",
       "      <td>110</td>\n",
       "      <td>19</td>\n",
       "      <td>15250.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>audi</td>\n",
       "      <td>sedan</td>\n",
       "      <td>99.8</td>\n",
       "      <td>176.6</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>102</td>\n",
       "      <td>24</td>\n",
       "      <td>13950.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>57</td>\n",
       "      <td>nissan</td>\n",
       "      <td>sedan</td>\n",
       "      <td>100.4</td>\n",
       "      <td>184.6</td>\n",
       "      <td>ohcv</td>\n",
       "      <td>six</td>\n",
       "      <td>152</td>\n",
       "      <td>19</td>\n",
       "      <td>13499.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>alfa-romero</td>\n",
       "      <td>convertible</td>\n",
       "      <td>88.6</td>\n",
       "      <td>168.8</td>\n",
       "      <td>dohc</td>\n",
       "      <td>four</td>\n",
       "      <td>111</td>\n",
       "      <td>21</td>\n",
       "      <td>13495.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60</th>\n",
       "      <td>88</td>\n",
       "      <td>volvo</td>\n",
       "      <td>wagon</td>\n",
       "      <td>104.3</td>\n",
       "      <td>188.8</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>114</td>\n",
       "      <td>23</td>\n",
       "      <td>13415.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>28</td>\n",
       "      <td>honda</td>\n",
       "      <td>sedan</td>\n",
       "      <td>96.5</td>\n",
       "      <td>175.4</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>101</td>\n",
       "      <td>24</td>\n",
       "      <td>12945.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59</th>\n",
       "      <td>87</td>\n",
       "      <td>volvo</td>\n",
       "      <td>sedan</td>\n",
       "      <td>104.3</td>\n",
       "      <td>188.8</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>114</td>\n",
       "      <td>23</td>\n",
       "      <td>12940.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>39</td>\n",
       "      <td>mazda</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>95.3</td>\n",
       "      <td>169.0</td>\n",
       "      <td>rotor</td>\n",
       "      <td>two</td>\n",
       "      <td>101</td>\n",
       "      <td>17</td>\n",
       "      <td>11845.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>29</td>\n",
       "      <td>honda</td>\n",
       "      <td>sedan</td>\n",
       "      <td>96.5</td>\n",
       "      <td>169.1</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>100</td>\n",
       "      <td>25</td>\n",
       "      <td>10345.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>58</th>\n",
       "      <td>86</td>\n",
       "      <td>volkswagen</td>\n",
       "      <td>sedan</td>\n",
       "      <td>97.3</td>\n",
       "      <td>171.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>100</td>\n",
       "      <td>26</td>\n",
       "      <td>9995.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>71</td>\n",
       "      <td>toyota</td>\n",
       "      <td>wagon</td>\n",
       "      <td>95.7</td>\n",
       "      <td>169.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>27</td>\n",
       "      <td>8778.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>52</td>\n",
       "      <td>mitsubishi</td>\n",
       "      <td>sedan</td>\n",
       "      <td>96.3</td>\n",
       "      <td>172.4</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>88</td>\n",
       "      <td>25</td>\n",
       "      <td>8189.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57</th>\n",
       "      <td>82</td>\n",
       "      <td>volkswagen</td>\n",
       "      <td>sedan</td>\n",
       "      <td>97.3</td>\n",
       "      <td>171.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>52</td>\n",
       "      <td>37</td>\n",
       "      <td>7995.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>56</th>\n",
       "      <td>81</td>\n",
       "      <td>volkswagen</td>\n",
       "      <td>sedan</td>\n",
       "      <td>97.3</td>\n",
       "      <td>171.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>85</td>\n",
       "      <td>27</td>\n",
       "      <td>7975.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52</th>\n",
       "      <td>70</td>\n",
       "      <td>toyota</td>\n",
       "      <td>wagon</td>\n",
       "      <td>95.7</td>\n",
       "      <td>169.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>27</td>\n",
       "      <td>7898.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55</th>\n",
       "      <td>80</td>\n",
       "      <td>volkswagen</td>\n",
       "      <td>sedan</td>\n",
       "      <td>97.3</td>\n",
       "      <td>171.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>52</td>\n",
       "      <td>37</td>\n",
       "      <td>7775.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>56</td>\n",
       "      <td>nissan</td>\n",
       "      <td>wagon</td>\n",
       "      <td>94.5</td>\n",
       "      <td>170.2</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>69</td>\n",
       "      <td>31</td>\n",
       "      <td>7349.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>27</td>\n",
       "      <td>honda</td>\n",
       "      <td>wagon</td>\n",
       "      <td>96.5</td>\n",
       "      <td>157.1</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>76</td>\n",
       "      <td>30</td>\n",
       "      <td>7295.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>53</td>\n",
       "      <td>nissan</td>\n",
       "      <td>sedan</td>\n",
       "      <td>94.5</td>\n",
       "      <td>165.3</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>55</td>\n",
       "      <td>45</td>\n",
       "      <td>7099.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>51</td>\n",
       "      <td>mitsubishi</td>\n",
       "      <td>sedan</td>\n",
       "      <td>96.3</td>\n",
       "      <td>172.4</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>88</td>\n",
       "      <td>25</td>\n",
       "      <td>6989.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>69</td>\n",
       "      <td>toyota</td>\n",
       "      <td>wagon</td>\n",
       "      <td>95.7</td>\n",
       "      <td>169.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>31</td>\n",
       "      <td>6918.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>55</td>\n",
       "      <td>nissan</td>\n",
       "      <td>sedan</td>\n",
       "      <td>94.5</td>\n",
       "      <td>165.3</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>69</td>\n",
       "      <td>31</td>\n",
       "      <td>6849.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>38</td>\n",
       "      <td>mazda</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>93.1</td>\n",
       "      <td>159.1</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>68</td>\n",
       "      <td>31</td>\n",
       "      <td>6795.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>30</td>\n",
       "      <td>isuzu</td>\n",
       "      <td>sedan</td>\n",
       "      <td>94.3</td>\n",
       "      <td>170.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>78</td>\n",
       "      <td>24</td>\n",
       "      <td>6785.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>54</td>\n",
       "      <td>nissan</td>\n",
       "      <td>sedan</td>\n",
       "      <td>94.5</td>\n",
       "      <td>165.3</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>69</td>\n",
       "      <td>31</td>\n",
       "      <td>6649.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>18</td>\n",
       "      <td>chevrolet</td>\n",
       "      <td>sedan</td>\n",
       "      <td>94.5</td>\n",
       "      <td>158.8</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>70</td>\n",
       "      <td>38</td>\n",
       "      <td>6575.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>68</td>\n",
       "      <td>toyota</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>95.7</td>\n",
       "      <td>158.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>31</td>\n",
       "      <td>6488.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>19</td>\n",
       "      <td>dodge</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>93.7</td>\n",
       "      <td>157.3</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>68</td>\n",
       "      <td>31</td>\n",
       "      <td>6377.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>67</td>\n",
       "      <td>toyota</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>95.7</td>\n",
       "      <td>158.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>31</td>\n",
       "      <td>6338.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>17</td>\n",
       "      <td>chevrolet</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>94.5</td>\n",
       "      <td>155.9</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>70</td>\n",
       "      <td>38</td>\n",
       "      <td>6295.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>20</td>\n",
       "      <td>dodge</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>93.7</td>\n",
       "      <td>157.3</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>68</td>\n",
       "      <td>31</td>\n",
       "      <td>6229.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>50</td>\n",
       "      <td>mitsubishi</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>93.7</td>\n",
       "      <td>157.3</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>68</td>\n",
       "      <td>31</td>\n",
       "      <td>6189.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>37</td>\n",
       "      <td>mazda</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>93.1</td>\n",
       "      <td>159.1</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>68</td>\n",
       "      <td>31</td>\n",
       "      <td>6095.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>49</td>\n",
       "      <td>mitsubishi</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>93.7</td>\n",
       "      <td>157.3</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>68</td>\n",
       "      <td>37</td>\n",
       "      <td>5389.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>66</td>\n",
       "      <td>toyota</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>95.7</td>\n",
       "      <td>158.7</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>62</td>\n",
       "      <td>35</td>\n",
       "      <td>5348.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>36</td>\n",
       "      <td>mazda</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>93.1</td>\n",
       "      <td>159.1</td>\n",
       "      <td>ohc</td>\n",
       "      <td>four</td>\n",
       "      <td>68</td>\n",
       "      <td>30</td>\n",
       "      <td>5195.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>16</td>\n",
       "      <td>chevrolet</td>\n",
       "      <td>hatchback</td>\n",
       "      <td>88.4</td>\n",
       "      <td>141.1</td>\n",
       "      <td>l</td>\n",
       "      <td>three</td>\n",
       "      <td>48</td>\n",
       "      <td>47</td>\n",
       "      <td>5151.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 48
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "d78d6aa75a54a030"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
